package com.sxbang.bms.service.impl;

import com.sxbang.bms.dao.UserDao;
import com.sxbang.bms.dto.UserDto;
import com.sxbang.bms.model.SysUser;
import com.sxbang.bms.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

	private static final Logger log = LoggerFactory.getLogger("adminLogger");

	@Autowired
	private UserDao userDao;

	@Override
	public SysUser getUser(String username) {
		return userDao.getUser(username);
	}

	@Override
	public SysUser getUserById(Long id) {
		return userDao.getById(id);
	}

	@Override
	public int deleteUser(Long id) {
		return userDao.deleteUser(id);
	}


	@Override
	public List<SysUser> getAllUsers() {
		return userDao.getAllUsers();
	}

	@Override
	public int save(SysUser user) {
		return userDao.save(user);
	}

	@Override
	@Transactional
	public int updateUser(UserDto userDto) {
		return userDao.updateUser(userDto);
	}

}
